"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var UploadManager = /** @class */ (function() {
  function UploadManager(client) {
    this.client = client;
  }
  UploadManager.prototype.UploadFile = function(params, callback) {
    if (params.FilePath == null || params.FilePath == "") {
      var err = {
        errMsg: "file path empty"
      }
      callback(err, null)
      return
    }

    if (params.PartSize == null || params.PartSize < 1024) {
      var err = {
        errMsg: "PartSize too small"
      }
      callback(err, null)
      return
    }

    uni.getFileInfo({
      filePath: params.FilePath,
      success: (res) => {
        if (res.size > params.PartSize) return callback(new Error('size too large'), null);
        this.client.PutObject(params, callback);
      },
      fail: (err) => {
        console.log('errerrerr123', err);
        this.client.PutObject(params, callback);
        callback(err, null)
      }
    })
  };
  return UploadManager;
}());
exports.UploadManager = UploadManager;
